<template>
</template>

<script  lang="ts">
export function throttle(func:any,wait:number):any{
    let timer:any=null;
    return ()=>{
        if(timer){
            return 0;
        }else{
            timer=setTimeout(()=>{
                func();
                timer=null;
            },wait)
        }
    }
}
export function debounce(func:any,wait:number):any{
let timer:any=null;//防抖,多个行为只执行最后一次
return ()=>{
    clearTimeout(timer);
    timer=setTimeout(func,wait);
    
}
}
</script>

<style scoped>

</style>